<div class="toolbar">
  <div class="group">
    选择被测设备：{{temperatureAvgData.cpu}}
    <nz-select [(ngModel)]="device" (ngModelChange)="deviceChangeEvent.emit($event)" nzShowSearch nzAllowClear nzPlaceHolder="选择设备" nzSize="small" style="width: 230px;">
      <nz-option *ngFor="let item of deviceList" [nzLabel]="item.basicInfo.hostName" [nzValue]="item"></nz-option>
    </nz-select>
  </div>
  <div class="group">
    <div class="wrapper" (click)="beforeTesting()">
      <div class="menu">
        <img src="assets/images/start.png"><br>
        <label>开始</label>
      </div>
    </div>
    <div *ngIf="testStatus!=='suspend' ; else resumeMenu" class="wrapper" (click)="suspend()">
      <div class="menu">
        <img src="assets/images/suspend.png"><br>
        <label>暂停</label>
      </div>
    </div>
    <ng-template #resumeMenu>
      <div *ngIf="testStatus==='suspend'" class="wrapper" (click)="continueRun()">
        <div class="menu">
          <img src="assets/images/resume.png"><br>
          <label>继续</label>
        </div>
      </div>
    </ng-template>


    <div class="wrapper" (click)="stop()">
      <div class="menu">
        <img src="assets/images/stop.png"><br>
        <label>结束</label>
      </div>
    </div>
    <div style="display: inline-block">
      <nz-radio-group [(ngModel)]="autoTest" (ngModelChange)="autoTestChange($event)">
        <label nz-radio [nzValue]="false" style="margin-bottom: 10px">手动测试</label><br>
        <label nz-radio [nzValue]="true">自动测试</label>
      </nz-radio-group>

    </div>


  </div>
  <div class="group">
    <div class="wrapper">
      <div class="menu" (click)="viewReport()">
        <img src="assets/images/report.png"><br>
        <label>查看报告</label>
      </div>
    </div>
    <div class="wrapper">
      <div class="menu" (click)="showLogView=!showLogView">
        <img src="assets/images/log.png"><br>
        <label>日志记录</label>
      </div>
    </div>

  </div>

</div>
<div class="main-wrapper">
  <div class="main">
    <div class="main-left">
      <div class="panel-title">
        <i nz-icon nzType="profile" nzTheme="fill"></i>测试工程
      </div>
      <div class="main-tree">
        <nz-tree
          #nzTreeComponent
          [nzData]="nodes"
          nzCheckable
          [nzCheckedKeys]="defaultCheckedKeys"
          [nzExpandedKeys]="defaultExpandedKeys"
          [nzSelectedKeys]="defaultSelectedKeys"
          (nzClick)="nzClick($event)"
          (nzContextMenu)="nzClick($event)"
          (nzCheckBoxChange)="nzCheck($event)"
          (nzExpandChange)="nzCheck($event)"
        ></nz-tree>

      </div>

    </div>
    <div class="main-right">
      <div class="main-center" [style.bottom.px]="showLogView?240:0">
        <div class="p-2">
          <ng-container *ngIf="testStatus==='running'||testStatus==='suspend'">
            {{totoProgress < 100 ? '测试执行中。。。' : '测试完成'}}
            <!--<button nz-button nzType="default" nzSize="small" nzDanger class="float-right" *ngIf="totoProgress<100">取消
            </button>-->
            <nz-progress [nzPercent]="totoProgress" nzStatus="active"></nz-progress>

          </ng-container>

          <ng-container *ngIf="nodes">
            <ng-container *ngFor="let rootNode of nodes">
              <ng-container *ngIf="rootNode.show">
                <div class="panel-sbuTitle">{{rootNode.title}}</div>
                <div>
                  <ng-container *ngFor="let item of rootNode.children">
                    <div class="test-item" *ngIf="item.checked">
                      <img src="assets/images/test-item1.png"><br>
                      <div class="test-name">
                        {{item.title}}
                      </div>
                      <nz-progress [nzPercent]="item.progress?item.progress:0" [nzShowInfo]="false" [nzStatus]="item.progress===100?'normal':'active'" style="width: 80px"></nz-progress>
                    </div>
                  </ng-container>
                </div>
              </ng-container>

            </ng-container>
          </ng-container>

        </div>


      </div>
      <div class="main-log" [hidden]="!showLogView">
        <div class="panel-title">
          <i nz-icon nzType="profile" nzTheme="fill"></i>日志信息
          <i (click)="clearLog()" nz-icon nzType="delete" nzTheme="outline" style="position: absolute;right: 5px;"></i>
        </div>
        <div class="p2" style="overflow-y: auto;height: 200px" (contextmenu)="contextMenu($event, menu)" #logContent>
          <nz-dropdown-menu #menu="nzDropdownMenu">
            <ul nz-menu>
              <li nz-menu-item (click)="clearLog()">清空日志</li>
              <li nz-menu-item (click)="logContent.scrollTop=0">滑到顶部</li>
              <li nz-menu-item (click)="logContent.scrollTop=logContent.scrollHeight">滑到底部</li>
            </ul>
          </nz-dropdown-menu>

          <div *ngFor="let item of logList">{{item}}</div>
        </div>
      </div>
    </div>
  </div>

</div>


